<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- 引入easyui 的主题样式  和  easyui 提供的图标样式 -->
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/themes/bootstrap/easyui.css"
	charset=UTF-8 />
<link rel="stylesheet"
	href="${pageContext.request.contextPath}/themes/icon.css" charset=UTF-8 />
<!-- 引入jquery 和  easyui.js   中文设置js-->
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery-1.9.1.js"
	charset=UTF-8></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery.easyui.min.js"
	charset=UTF-8></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/easyui-lang-zh_CN.js"
	charset=UTF-8></script>
</head>
<script type="text/javascript">
$(function() {
	//管理员设置下拉框	
	$('#uid').combobox({  
	    url:'searchuid',    
	    valueField:'id',    
	    textField:'text',
	    onSelect: function(rec){    
	    	var uid = $("#uid").combo('getText');  
	    	$.ajax({
				url:'findu',	
				type:'post',
				data:{'uid':uid},
				datatype:'text',
				success:function(data){
					$("#uname").val(data);
				}
        })
        }
	});  
	//上行站点设置下拉框
	$('#pname1').combobox({  
	    url:'findup',    
	    valueField:'id',    
	    textField:'text',
	})
	//新增代理点
	$("#save").linkbutton({
		onClick:function(){
			var pname = $("#pname").val();
			var pname1 = $("#pname1").combo('getText');
			var uid = $("#uid").combo('getText');
			$.ajax({
				url:'saveproxy',
				type:'post',
				data:{'pname':pname,'pname1':pname1,'uid':uid},
				datatype:'text',
				success:function(data){
					if(data=='1'){
						$.messager.alert('success','添加成功！','info');
						$("#pname").val("");  // 清空修改输入框
						$('#uid').combobox('setValue','');
						$("#uname").val("");
						$('#pname1').combobox('setValue','');
					}
				}
			})
		  }
		})
})
</script>
<body>
	<div name="point" align="center"  >
		<table border="1" cellpadding="1" cellspacing="1" bordercolor="gray">
			<tr>
				<td>代理点名称 ： <input id="pname" name="pname" style="width:130px"/></td>
				<td>上行站点：<input class="easyui-combobox" editable="false" id="pname1" name="pname1" style="width:130px" ></td>
			</tr>
			<tr>
				<td>管理员编码：<input class="easyui-combobox" editable="false" id="uid" name="uid" style="width:130px" ></td>
				<td>管理员名称：<input id="uname" name="uname" readOnly="true"  style="width:130px" /></td>
			</tr>
			<tr>
				<td align="right"><button class="easyui-linkbutton" id="save">确&nbsp;&nbsp;定</button></td>
				<td align="left"><button class="easyui-linkbutton" id="canel">清&nbsp;&nbsp;空</button></td>
			</tr>
		</table>
	</div>
</body>
</html>